package com.derbysoft.lowcostadapter.schedule.sync.impl;

import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;

public class SyncFile {
    private String name = "";
    private String ftpHost = "";
    private int ftpPort = 0;
    private String ftpUserName = "";
    private String ftpPassword = "";
    private String ftpRemotePath = "";

    static SyncFile fromJson(String input) {
        if (StringUtils.isBlank(input)) {
            return null;
        }
        return (SyncFile) JSONObject.toBean(JSONObject.fromObject(input), SyncFile.class);
    }

    static String defaultJson() {
        return JSONObject.fromObject(new SyncFile()).toString(4);
    }

    public String getName() {
        return name;
    }

    public String getFtpHost() {
        return ftpHost;
    }

    public int getFtpPort() {
        return ftpPort;
    }

    public String getFtpUserName() {
        return ftpUserName;
    }

    public String getFtpPassword() {
        return ftpPassword;
    }

    public String getFtpRemotePath() {
        return ftpRemotePath;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setFtpHost(String ftpHost) {
        this.ftpHost = ftpHost;
    }

    public void setFtpPort(int ftpPort) {
        this.ftpPort = ftpPort;
    }

    public void setFtpUserName(String ftpUserName) {
        this.ftpUserName = ftpUserName;
    }

    public void setFtpPassword(String ftpPassword) {
        this.ftpPassword = ftpPassword;
    }

    public void setFtpRemotePath(String ftpRemotePath) {
        this.ftpRemotePath = ftpRemotePath;
    }

    @Override
    public String toString() {
        return JSONObject.fromObject(this).toString();
    }
}
